<template>
    <div>
        <Modal v-model="modal.add" title="添加" :mask-closable="false" @on-visible-change="changeModalVisibleResetForm('addForm', $event)" width="1020">
            <Form ref="addForm" :model="form" :label-width="120" :rules="validateRules">
                <Row>
	<i-col span="12">
	<FormItem label="订单号" prop="orderId">
	<Input v-model="form.orderId" placeholder="请输入订单号" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="下单用户" prop="userId">
	<InputNumber v-model="form.userId" placeholder="请输入下单用户" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="图文店" prop="graphicId">
	<InputNumber v-model="form.graphicId" placeholder="请输入图文店" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="优惠券编号" prop="couponsId">
	<InputNumber v-model="form.couponsId" placeholder="请输入优惠券编号" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="纸张类型" prop="zzlx">
	<Input v-model="form.zzlx" placeholder="请输入纸张类型" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="颜色" prop="ys">
	<Input v-model="form.ys" placeholder="请输入颜色" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="单双面" prop="dsm">
	<Input v-model="form.dsm" placeholder="请输入单双面" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="页码范围" prop="ymfw">
	<Input v-model="form.ymfw" placeholder="请输入页码范围" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="打印数量" prop="dysl">
	<InputNumber v-model="form.dysl" placeholder="请输入打印数量" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="订单金额" prop="totalAmount">
	<InputNumber v-model="form.totalAmount" placeholder="请输入订单金额" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="实付金额" prop="payAmount">
	<InputNumber v-model="form.payAmount" placeholder="请输入实付金额" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="优惠金额" prop="discountAmount">
	<InputNumber v-model="form.discountAmount" placeholder="请输入优惠金额" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="支付状态" prop="payStatus">
	<InputNumber v-model="form.payStatus" placeholder="请输入支付状态" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="下单时间" prop="placeOrderTime">
	<DatePicker @on-change="form.placeOrderTime=$event" :value="form.placeOrderTime" placeholder="请输入下单时间" type="datetime" format="yyyy-MM-dd HH:mm:ss" style="width: 100%;" clearable></DatePicker>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="备注" prop="beizhu">
	<Input v-model="form.beizhu" placeholder="请输入备注" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="微信订单号" prop="wxOrder">
	<Input v-model="form.wxOrder" placeholder="请输入微信订单号" clearable/>
</FormItem>
	</i-col>

</Row>

            </Form>
            <div slot="footer">
                <Button type="text" size="large" @click="resetFormCancelModal('addForm', 'add')">取消</Button>
                <Button type="primary" size="large" @click="add" :loading="loading.add">添加</Button>
            </div>
        </Modal>
        <Modal v-model="modal.edit" title="修改" :mask-closable="false" @on-visible-change="changeModalVisibleResetForm('editForm', $event)" width="1020">
            <Form ref="editForm" :model="form" :label-width="120" :rules="validateRules">
                <Row>
	<i-col span="12">
	<FormItem label="订单号" prop="orderId">
	<Input v-model="form.orderId" placeholder="请输入订单号" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="下单用户" prop="userId">
	<InputNumber v-model="form.userId" placeholder="请输入下单用户" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="图文店" prop="graphicId">
	<InputNumber v-model="form.graphicId" placeholder="请输入图文店" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="优惠券编号" prop="couponsId">
	<InputNumber v-model="form.couponsId" placeholder="请输入优惠券编号" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="纸张类型" prop="zzlx">
	<Input v-model="form.zzlx" placeholder="请输入纸张类型" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="颜色" prop="ys">
	<Input v-model="form.ys" placeholder="请输入颜色" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="单双面" prop="dsm">
	<Input v-model="form.dsm" placeholder="请输入单双面" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="页码范围" prop="ymfw">
	<Input v-model="form.ymfw" placeholder="请输入页码范围" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="打印数量" prop="dysl">
	<InputNumber v-model="form.dysl" placeholder="请输入打印数量" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="订单金额" prop="totalAmount">
	<InputNumber v-model="form.totalAmount" placeholder="请输入订单金额" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="实付金额" prop="payAmount">
	<InputNumber v-model="form.payAmount" placeholder="请输入实付金额" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="优惠金额" prop="discountAmount">
	<InputNumber v-model="form.discountAmount" placeholder="请输入优惠金额" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="支付状态" prop="payStatus">
	<InputNumber v-model="form.payStatus" placeholder="请输入支付状态" style="width: 100%;"/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="下单时间" prop="placeOrderTime">
	<DatePicker @on-change="form.placeOrderTime=$event" :value="form.placeOrderTime" placeholder="请输入下单时间" type="datetime" format="yyyy-MM-dd HH:mm:ss" style="width: 100%;" clearable></DatePicker>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="备注" prop="beizhu">
	<Input v-model="form.beizhu" placeholder="请输入备注" clearable/>
</FormItem>
	</i-col>
<i-col span="12">
	<FormItem label="微信订单号" prop="wxOrder">
	<Input v-model="form.wxOrder" placeholder="请输入微信订单号" clearable/>
</FormItem>
	</i-col>

</Row>

            </Form>
            <div slot="footer">
                <Button type="text" size="large" @click="resetFormCancelModal('editForm', 'edit')">取消</Button>
                <Button type="primary" size="large" @click="edit" :loading="loading.edit">修改</Button>
            </div>
        </Modal>
    </div>
</template>

<script>
    import * as utils from '@/api/utils-v2'
    import * as ResponseStatus from '@/api/response-status'
    export default {
        name: 'GraphicOrderAddEdit',
        data() {
            return {
                modal: {
                    add: false,
                    edit: false
                },
                loading: {
                    add: false,
                    edit: false
                },
                urls: {
                    addUrl: '/graphic-order/admin/save',
                    batchAddUrl: '/graphic-order/admin/batch-save',
                    editUrl: '/graphic-order/admin/update',
                    batchEditUrl: '/graphic-order/admin/batch-update'
                },
                form: {
                    orderId: null,
userId: null,
graphicId: null,
couponsId: null,
zzlx: null,
ys: null,
dsm: null,
ymfw: null,
dysl: null,
totalAmount: null,
payAmount: null,
discountAmount: null,
payStatus: null,
placeOrderTime: null,
beizhu: null,
wxOrder: null,

                },
                validateRules: {
                    orderId: [
{type: 'string', required: true, message: '此项为必须项', trigger: 'blur'},
{type: 'string', min: 1, max: 100, message: '必须1-100个字符', trigger: 'blur'}
],
userId: [
{type: 'integer', required: true, message: '此项为必须项', trigger: 'blur, change'}
],
graphicId: [
{type: 'integer', required: true, message: '此项为必须项', trigger: 'blur, change'}
],
zzlx: [
{type: 'string', required: true, message: '此项为必须项', trigger: 'blur'},
{type: 'string', min: 1, max: 255, message: '必须1-255个字符', trigger: 'blur'}
],
ys: [
{type: 'string', required: true, message: '此项为必须项', trigger: 'blur'},
{type: 'string', min: 1, max: 255, message: '必须1-255个字符', trigger: 'blur'}
],
dsm: [
{type: 'string', required: true, message: '此项为必须项', trigger: 'blur'},
{type: 'string', min: 1, max: 255, message: '必须1-255个字符', trigger: 'blur'}
],
ymfw: [
{type: 'string', required: true, message: '此项为必须项', trigger: 'blur'},
{type: 'string', min: 1, max: 255, message: '必须1-255个字符', trigger: 'blur'}
],
dysl: [
{type: 'integer', required: true, message: '此项为必须项', trigger: 'blur, change'}
],
beizhu: [
{type: 'string', min: 1, max: 500, message: '必须1-500个字符', trigger: 'blur'}
],
wxOrder: [
{type: 'string', min: 1, max: 255, message: '必须1-255个字符', trigger: 'blur'}
],

                },
                dataDictCodes: [],
                dataDictItems: {},
            }
        },
        computed: {},
        mounted() {},
        methods: {
            changeModalVisibleResetForm(formRef, visible) {
                if (!visible) {
                    this.$refs[formRef].resetFields()
                    this.form.id = null
                }
            },
            resetFormCancelModal(formRef, modal) {
                this.modal[modal] = false
                this.$refs[formRef].resetFields()
                this.form.id = null
            },
            add() {
                this.$emit('add')
            },
            edit() {
                this.$emit('edit')
            }
        }
    }
</script>

<style>
</style>